package com.chixing.service.impl;

import com.chixing.mapper.HotelInfoMapper;
import com.chixing.pojo.HotelInfo;
import com.chixing.pojo.HotelInfoExample;
import com.chixing.service.HotelService;
import com.chixing.util.ServerResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class HotelServiceImpl implements HotelService {
    @Autowired
    public HotelInfoMapper hotelInfoMapper;

    @Override
    public List<HotelInfo> getByHotelCity(String hotelCity) {
        HotelInfoExample example =  new HotelInfoExample();
        example.createCriteria().andHotelCityEqualTo(hotelCity);
        List<HotelInfo> hotelInfoList = hotelInfoMapper.selectByExample(example);
        if (hotelInfoList.size()>0){
            return hotelInfoList;
        }
        return null;
    }

    @Override
    public List<HotelInfo> getByName(String hotelName) {
        HotelInfoExample example =  new HotelInfoExample();
        example.createCriteria().andHotelNameEqualTo(hotelName);
        List<HotelInfo> hotelInfoList = hotelInfoMapper.selectByExample(example);
        if (hotelInfoList.size()>0){
            return hotelInfoList;
        }
        return null;
    }
}
